//
//  UIButton+Extension.swift
//  MyWeiboApp
//
//  Created by 胡海波 on 15/7/4.
//  Copyright © 2015年 胡海波. All rights reserved.
//

import UIKit

extension UIButton {

    convenience init(title: String,imageName:String,fontSize:CGFloat,titleColor: UIColor = UIColor.darkGrayColor()){

        self.init()

        setTitle(" " + title, forState: UIControlState.Normal)
        setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        setTitleColor(titleColor, forState: UIControlState.Normal)

        titleLabel?.font = UIFont.systemFontOfSize(fontSize)
    }

    convenience init(title: String, fontSize: CGFloat, titleColor: UIColor = UIColor.whiteColor(), bgColor: UIColor = UIColor.brownColor()) {

        self.init()

        setTitle(title, forState: UIControlState.Normal)
        titleLabel?.font = UIFont.systemFontOfSize(fontSize)
        setTitleColor(titleColor, forState: UIControlState.Normal)
        backgroundColor = bgColor
    }

}
